let login =(req,resp)=>{
    let query=req.query;
    let name=query.name;
    let pwd=query.pwd;


    if(name===global.usersname&&pwd===global.userspwd){

        resp.send("登录成功")

    }else {
        throw new Error("用户名或者密码错误")
    }

}
let regist=(req,resp)=>{
    let body=req.body
    let name=body.name
    let pwd=body.pwd
    global.usersname=name
    global.userspwd=pwd
    resp.send("注册成功")
}

let getUserInfo=(req,resp)=>{
    let header=req.header
    let token =header.token
    let cookies=req.cookies
    let weihao =cookies.weihao
    resp.cookie("xiejin","1111")


    resp.send({
        name:"xiejin",
        token,
        cookieKey:"xiejin"
    })
}
module.exports={
    login,
    regist,
    getUserInfo
}